# returns lowercase string

tolower () { 
  echo "$1" | tr '[:upper:]' '[:lower:]' 
}

toupper () { 
  echo "$1" | tr '[:lower:]' '[:upper:]' 
}

str_replace () {
  local ORIG="$1"
  local DEST="$2"
  local DATA="$3"

  echo "$DATA" | sed "s/$ORIG/$DEST/g"
}

trim () { 
  echo $1; 
}

string_quote () {
  local STRING=$1
  local i ch
  for ((i=0; $i < "${#STRING}"; ++i)); do
    ch="${STRING:$i:1}"
    test "$ch" = \\ && ch=\\\\
    printf '%s' "$ch"
  done
  printf '\n'
  return 0
}

